.header {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 $grid-basic*2 0;
  min-height: $headerHeight;
  width: 100%;

  background-color: #fff;
  z-index: $header-zindex;

  @media(max-width: $break-tablet-max) {
    padding: $grid-basic;
  }
}


.header-logo {
  flex: 0 0 auto;
  > a {
    display: inline-block;
  }

  img {
    width: 151px;
  }

  @media(max-width: $break-tablet-max) {
    margin-right: auto;

    img {
      width: 120px;
    }
  }
}

.header-navigation {
  position: relative; // for header search expand
  display: flex;
  align-items: center;

  @media(max-width: $break-tablet-max) {
    display: none;
  }
}

// header search
.header-search-button {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8c8a8b;
  cursor: pointer;
  &:hover {
    color: #000;
  }

  @media(max-width: $break-tablet-max) {
    display: none;
  }
}

.header-search-forms {
  display: none;
  position: absolute;
  top:0;
  left: 0px;
  padding: 2px 0;
  height: $headerHeight;
  width: 100%;
  z-index: 10;

  .fa {
    position: absolute;
    top: 16px;
    left: 17px;
    color: #8c8a8b;
  }

  input[type="search"] {
    height: 40px;
    background-color: #e9f4f8;
    color: #768e99;
    border: none;
    width: 100%;
    padding-left: 40px;

    &:placeholder-shown {
      color: #768e99;
    }
    &::-webkit-input-placeholder {
      color: #768e99;
    }
    &:-ms-input-placeholder {
      color: #768e99;
    }
    &::-moz-placeholder {
      color: #768e99;
    }
  }
  input[type="submit"] {
    display: none;
  }
}

// CNReq-26 検索ボタン
.header-close {
    display: none;
    cursor: pointer;
    width: 25px;
}

// header category navigation
.header-category-container {
  $firstLevelItemHeight: $headerHeight;
  $firstLevelItemClass: ".header-category";
  $secondLevelItemClass: ".header-category-2nd";

  display: flex;
  flex-wrap: wrap;
  align-items: center;

  #{$firstLevelItemClass} {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: $grid-basic $grid-basic*2 0;
    margin-right: $grid-basic*2;
    height: $firstLevelItemHeight - 4;
    position: relative;
    border-bottom: 4px solid transparent;
    cursor: pointer;
    white-space: nowrap;

    &:last-child {
      margin-right: 0;
    }

    &:hover {
      border-bottom: 4px solid $brand-blue-line;

      > #{$secondLevelItemClass} {
        display: block;
      }
    }

    &-name {
      text-decoration: none;
      color: $brand-black;
    }
  }

  #{$secondLevelItemClass} {
    display: none;
    position: absolute;
    top: $firstLevelItemHeight - 4px;
    left: 0;
    z-index: $header-zindex;
    width: 270px;
    background-color: #FFF;

    &-item {
      border-bottom: 1px solid #F0F0F0;
      > a {
        display: block;
        padding: $grid-basic $grid-basic*1.5;
        text-decoration: none;

        &:hover {
          background-color: #F0F0F0;
        }
      }
    }

    &-item-name {
      font-size: 1.1rem;
      color: #3ea6df;
      white-space: normal;
    }

    &-item-description {
      margin: 5px 0 0 0;
      font-size: 0.9rem;
      line-height: 1rem;
      white-space: normal;
      color: #666;
    }
  }
}

// header category navigation
.header-account {
  display: flex;
  align-items: center;

  nav.user-nav {
    margin-bottom: 3px;
    position: relative;
    > * {
      margin: 0;
    }
    [role="button"] {
      padding: 5px 12px;
      border:none;
      color: #fff;
      font-size: 0.9rem;
      background-color: #2695cc;
      &:hover {
        color: $brand-blue-ahover;
        background-color: #b7e0e4;
      }
    }
  }

  .memberCount {
    display: block;
    position: absolute;
    z-index: 10;
    right: 0;
    padding: 2px 10px;
    background-color: transparentize(#FFF, 0.1);
    border-radius: 10px;
    font-size: 0.7rem;
    white-space: nowrap;
    .number {
      font-size: 0.9rem;
    }
    &:after {
      content: "";
      width: 0;
      height: 0;
      position: absolute;
      right: 20px;
      top:-10px;
      border-style: solid;
      border-width: 5px;
      border-color: transparent transparent transparentize(#FFF, 0.1) transparent;
    }
  }
}

.header-language-container {
  $firstLevelItemClass: ".header-language";
  $secondLevelItemClass: ".header-language-2nd";

  position: relative;
  display: flex;
  align-items: center;
  margin-right: $grid-basic * 2;

  @media(max-width: $break-tablet-max) {
    display: none;
  }

  #{$firstLevelItemClass} {
    > a {
      display: inline-flex;
      align-items: center;
      padding: $grid-basic/2 $grid-basic;
      color: #9B9B9B;
      text-decoration: none;
      border-radius: 2px;
      height: 35px;
      white-space: nowrap;
      &:hover {
        background-color: #F0F0F0;
      }

      .fa-globe {
        margin-right: 2px;
      }
      .fa-caret-down {
        margin-right: 4px;
      }
    }

    &:hover {
      #{$secondLevelItemClass} {
        display: block;
      }
    }
  }

  #{$secondLevelItemClass} {
    display: none;
    position: absolute;
    z-index: 10;
    top: 35px;
    background-color: #FFF;
    width: 100px;

    &-item {
      a {
        display: block;
        padding: $grid-basic;
        text-decoration: none;
        &:hover {
          background-color: #F0F0F0;
        }
      }
    }
  }
}

.header-mobileMenu {
  display: none;

  @media(max-width: $break-tablet-max) {
    display: block;
    margin-left: $grid-basic*2;
    width: 30px;
    text-align: center;
  }
}

.mobileMenu {
  @include mobileMenuBase;

  &-background {
    @include mobileMenuBackgroundBase
  }

  &-inner {
    @include mobileMenuInnerBase;
  }

  &-close {
    text-align: right;
    > a {
      display: inline-block;
      padding: 8px;
      color: $brand-black;
    }
    .fa {
      font-size: 1.5rem;
      vertical-align: text-bottom;
    }
  }

  &-search {
    margin-bottom: $grid-basic*2;

    form.search {
      display: flex;
    }

    input[type=search] {
      flex: 1 0 auto;
      margin-right: $grid-basic;
    }
  }

  &-tree {
    margin-bottom: $grid-basic*3;
  }

  &-tree-title {
    font-weight: bold;
    margin-bottom: $grid-basic/2;
  }

  &-tree-item {
    margin-bottom: $grid-basic;
    > a {
      display: block;
      color: $brand-black;
      text-decoration: none;
      padding: 4px;
    }
    span {
      color: #158ec2;
    }
    p {
      font-size: 0.8rem;
      margin: 0;
    }

    &:active {
      background-color: transparentize(#FFF, 1-0.9);
    }

  }
}
